home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectSound / EffectsBuffers / frmCompressor.frm < prev    next >
Text File  |  2001-10-08  |  8KB  |  287 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmCompressor 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Compressor Effects Update"
  6.    ClientHeight    =   2145
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   5550
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   2145
  14.    ScaleWidth      =   5550
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  'CenterOwner
  17.    Begin VB.CommandButton cmdOK 
  18.       Caption         =   "OK"
  19.       Height          =   315
  20.       Left            =   4560
  21.       TabIndex        =   12
  22.       Top             =   1680
  23.       Width           =   915
  24.    End
  25.    Begin MSComctlLib.Slider sldAttack 
  26.       Height          =   195
  27.       Left            =   60
  28.       TabIndex        =   0
  29.       Top             =   300
  30.       Width           =   2655
  31.       _ExtentX        =   4683
  32.       _ExtentY        =   344
  33.       _Version        =   393216
  34.       LargeChange     =   10
  35.       SmallChange     =   5
  36.       Min             =   1
  37.       Max             =   500
  38.       SelStart        =   1
  39.       TickFrequency   =   33
  40.       Value           =   1
  41.    End
  42.    Begin MSComctlLib.Slider sldOutputGain 
  43.       Height          =   195
  44.       Left            =   60
  45.       TabIndex        =   1
  46.       Top             =   840
  47.       Width           =   2655
  48.       _ExtentX        =   4683
  49.       _ExtentY        =   344
  50.       _Version        =   393216
  51.       LargeChange     =   10
  52.       SmallChange     =   2
  53.       Min             =   -60
  54.       Max             =   60
  55.       TickFrequency   =   10
  56.    End
  57.    Begin MSComctlLib.Slider sldDelay 
  58.       Height          =   195
  59.       Left            =   60
  60.       TabIndex        =   2
  61.       Top             =   1380
  62.       Width           =   2655
  63.       _ExtentX        =   4683
  64.       _ExtentY        =   344
  65.       _Version        =   393216
  66.       LargeChange     =   1
  67.       Max             =   4
  68.    End
  69.    Begin MSComctlLib.Slider sldRatio 
  70.       Height          =   195
  71.       Left            =   2820
  72.       TabIndex        =   3
  73.       Top             =   840
  74.       Width           =   2655
  75.       _ExtentX        =   4683
  76.       _ExtentY        =   344
  77.       _Version        =   393216
  78.       LargeChange     =   10
  79.       Min             =   1
  80.       Max             =   100
  81.       SelStart        =   1
  82.       TickFrequency   =   10
  83.       Value           =   1
  84.    End
  85.    Begin MSComctlLib.Slider sldRelease 
  86.       Height          =   195
  87.       Left            =   2835
  88.       TabIndex        =   4
  89.       Top             =   1365
  90.       Width           =   2655
  91.       _ExtentX        =   4683
  92.       _ExtentY        =   344
  93.       _Version        =   393216
  94.       LargeChange     =   10
  95.       SmallChange     =   5
  96.       Min             =   50
  97.       Max             =   3000
  98.       SelStart        =   50
  99.       TickFrequency   =   100
  100.       Value           =   50
  101.    End
  102.    Begin MSComctlLib.Slider sldThreshold 
  103.       Height          =   195
  104.       Left            =   2820
  105.       TabIndex        =   10
  106.       Top             =   300
  107.       Width           =   2655
  108.       _ExtentX        =   4683
  109.       _ExtentY        =   344
  110.       _Version        =   393216
  111.       LargeChange     =   10
  112.       Min             =   -60
  113.       Max             =   0
  114.       TickFrequency   =   5
  115.    End
  116.    Begin VB.Label lbl 
  117.       BackStyle       =   0  'Transparent
  118.       Caption         =   "Threshold"
  119.       Height          =   255
  120.       Index           =   8
  121.       Left            =   2820
  122.       TabIndex        =   11
  123.       Top             =   60
  124.       Width           =   735
  125.    End
  126.    Begin VB.Label lbl 
  127.       BackStyle       =   0  'Transparent
  128.       Caption         =   "Ratio"
  129.       Height          =   255
  130.       Index           =   4
  131.       Left            =   2820
  132.       TabIndex        =   9
  133.       Top             =   600
  134.       Width           =   1035
  135.    End
  136.    Begin VB.Label lbl 
  137.       BackStyle       =   0  'Transparent
  138.       Caption         =   "Pre-Delay"
  139.       Height          =   255
  140.       Index           =   3
  141.       Left            =   60
  142.       TabIndex        =   8
  143.       Top             =   1140
  144.       Width           =   1035
  145.    End
  146.    Begin VB.Label lbl 
  147.       BackStyle       =   0  'Transparent
  148.       Caption         =   "Gain"
  149.       Height          =   255
  150.       Index           =   0
  151.       Left            =   60
  152.       TabIndex        =   7
  153.       Top             =   600
  154.       Width           =   1215
  155.    End
  156.    Begin VB.Label lbl 
  157.       BackStyle       =   0  'Transparent
  158.       Caption         =   "Attack"
  159.       Height          =   255
  160.       Index           =   1
  161.       Left            =   60
  162.       TabIndex        =   6
  163.       Top             =   60
  164.       Width           =   735
  165.    End
  166.    Begin VB.Label lbl 
  167.       BackStyle       =   0  'Transparent
  168.       Caption         =   "Release"
  169.       Height          =   255
  170.       Index           =   2
  171.       Left            =   2835
  172.       TabIndex        =   5
  173.       Top             =   1125
  174.       Width           =   1035
  175.    End
  176. End
  177. Attribute VB_Name = "frmCompressor"
  178. Attribute VB_GlobalNameSpace = False
  179. Attribute VB_Creatable = False
  180. Attribute VB_PredeclaredId = True
  181. Attribute VB_Exposed = False
  182. Option Explicit
  183. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  184. '
  185. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  186. '
  187. '  File:       frmCompressor.frm
  188. '
  189. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  190. Private oBuffer As DirectSoundSecondaryBuffer8
  191. Private mlIndex As Long
  192.  
  193. Private oFX As DirectSoundFXCompressor8
  194. Private Sub SaveAllSettings()
  195.     Dim fxNew As DSFXCOMPRESSOR
  196.     
  197.     'Ok, save these new settings
  198.     'Set the new information up
  199.     With fxNew
  200.         .fAttack = CSng(sldAttack.Value)
  201.         .fGain = CSng(sldOutputGain.Value)
  202.         .fPredelay = CSng(sldDelay.Value)
  203.         .fRatio = CSng(sldRatio.Value)
  204.         .fRelease = CSng(sldRelease.Value)
  205.         .fThreshold = CSng(sldThreshold.Value)
  206.     End With
  207.     'Now update the effect
  208.     oFX.SetAllParameters fxNew
  209. End Sub
  210.  
  211. Private Sub cmdOK_Click()
  212.     SaveAllSettings
  213.     Unload Me
  214. End Sub
  215.  
  216. Private Sub Form_Load()
  217.     Dim fxCurrent As DSFXCOMPRESSOR
  218.     
  219.     'Get the echo interface
  220.     Set oFX = oBuffer.GetObjectinPath(DSFX_STANDARD_COMPRESSOR, mlIndex, IID_DirectSoundFXCompressor)
  221.     'Get the current settings from it
  222.     fxCurrent = oFX.GetAllParameters
  223.     'Now put them out there
  224.     With fxCurrent
  225.         sldAttack.Value = CLng(.fAttack)
  226.         sldOutputGain.Value = CLng(.fGain)
  227.         sldDelay.Value = CLng(.fPredelay)
  228.         sldRatio.Value = CLng(.fRatio)
  229.         sldRelease.Value = CLng(.fRelease)
  230.         sldThreshold.Value = CLng(.fThreshold)
  231.     End With
  232. End Sub
  233.  
  234. Public Sub SetBuffer(oBuf As DirectSoundSecondaryBuffer8, Index As Long)
  235.     'Store the buffer and index
  236.     Set oBuffer = oBuf
  237.     mlIndex = Index
  238. End Sub
  239.  
  240. Private Sub sldAttack_Change()
  241.     SaveAllSettings
  242. End Sub
  243.  
  244. Private Sub sldAttack_Scroll()
  245.     SaveAllSettings
  246. End Sub
  247.  
  248. Private Sub sldDelay_Change()
  249.     SaveAllSettings
  250. End Sub
  251.  
  252. Private Sub sldDelay_Scroll()
  253.     SaveAllSettings
  254. End Sub
  255.  
  256. Private Sub sldOutputGain_Change()
  257.     SaveAllSettings
  258. End Sub
  259.  
  260. Private Sub sldOutputGain_Scroll()
  261.     SaveAllSettings
  262. End Sub
  263.  
  264. Private Sub sldRatio_Change()
  265.     SaveAllSettings
  266. End Sub
  267.  
  268. Private Sub sldRatio_Scroll()
  269.     SaveAllSettings
  270. End Sub
  271.  
  272. Private Sub sldRelease_Change()
  273.     SaveAllSettings
  274. End Sub
  275.  
  276. Private Sub sldRelease_Scroll()
  277.     SaveAllSettings
  278. End Sub
  279.  
  280. Private Sub sldThreshold_Change()
  281.     SaveAllSettings
  282. End Sub
  283.  
  284. Private Sub sldThreshold_Scroll()
  285.     SaveAllSettings
  286. End Sub
  287.